package com.qf.service;

import com.qf.dao.TaskDao;
import com.qf.dao.impl.TaskDaoImpl;
import com.qf.entity.Task;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.util.Date;

/**
 * 2019/10/8
 * Administrator
 * springQuartz1008
 * 面向对象面向君  不负代码不负卿
 */
//任务类
public class JobService extends QuartzJobBean {
    private TaskDao dao;
    private String username;

    public void setUsername(String username) {
        System.out.println("setusername");
        this.username = username;
    }

    public void setDao(TaskDao dao) {
        System.out.println("setdao");
        this.dao = dao;
    }
    //等价于原来的execute()
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        Task task = dao.findbyname(username);
        System.out.println(new Date()+","+task);
    }
}
